package com.zyh.test02.controller;


import com.zyh.test02.entity.Course;
import com.zyh.test02.entity.Student;
import com.zyh.test02.service.CourseService;
import com.zyh.test02.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/student")
public class TestController {

    @Autowired
    StudentService studentService;

    @Autowired
    CourseService courseService;

    @RequestMapping("/getStudent/{id}")
    public Student getStudent(@PathVariable String id){
        return studentService.selStudentById(id);
    }

    @RequestMapping("/getStudent/test")
    public String Test(){
        return "OK";
    }

    @RequestMapping("/getCourse/{cid}")
    public Course getCourse(@PathVariable String cid){
        return courseService.getCourseByCId(cid);    // 啊啊啊啊啊
    }
}
